<template>
	<view class="tab-bar">
		<view class="tab-bar-border"></view>
		<view v-for="(item,index) in tabBarList" :key="index" class="tab-bar-item" :data-id="index" @click="jump(item)">
			<image :src="current == item.index ? item.selectedIconPath : item.iconPath"></image>
			<view :style="{'color':current == item.index ? '#007AFF' : '#7A7E83'}">
				{{item.text}}
			</view>
		</view>
	</view>

</template>

<script>
	import tabBarData from '@/common/tabBarList.js'
	export default {
		props: {
			current: Number
		},
		data() {
			return {
				tabBarList: []
			}

		},
		mounted() {
			// console.log(this.$store.state.userType,'this.$store.state.userType');
			if (this.$store.state.userType == 7 || this.$store.state.userType == 6) {
				this.tabBarList = tabBarData.loadUser
			} else {
				this.tabBarList = tabBarData.yunUser
			}
		},
		methods: {
			// 点击跳转对应tabbar页面
			jump(e) {
				console.log(e, '路径信息');
				uni.reLaunch({
					url: e.pagePath,
					// success:(res)=>{
					// 	console.log(res);
					// },
					fail: (err) => {
						console.log(err);
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tab-bar {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		height: 96rpx;
		border-top: 2rpx solid #ccc;
		background: white;
		display: flex;
	}

	.tab-bar-border {
		// background-color: rgba(0, 0, 0, 0.33);
		background-color: white;
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 2rpx;
		border-top: 2rpx solid rgba(187, 187, 187, 0.3);
		transform: scaleY(0.5);
	}

	.tab-bar-item {
		flex: 1;
		text-align: center;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
	}

	.tab-bar-item image {
		width: 48rpx;
		height: 48rpx;
	}

	.tab-bar-item view {
		font-size: 24rpx;
		line-height: 30rpx;
		margin-top: 6rpx;
	}
</style>